<template>
    <el-dialog
    :title="'审核'"
    :visible.sync="dialogVisible"
    width="100%"
    :fullscreen="true"
    :before-close="handleClose">
    <div class="xlSeeFrom">
        <div class="step">
            <el-steps :active="this.statusNum" finish-status="success" simple>
            <el-step title="尚未发起审批" ></el-step>
            <el-step title="财务经理审核中" ></el-step>
            <el-step title="PM审核中" ></el-step>
            <el-step title="PMO审核中" ></el-step>
            <el-step title="运营总监审核中" ></el-step>
            <el-step title="审核完成" ></el-step>
            </el-steps>
        </div>

        <div class="tab-item">
            <!--报销单说明-->
            <div class="item">
            <p class="tab-title">报销单说明</p>
            <div class="tab">
                <table>
              <tr>
                <td>报销单编号</td>
                <td>报销单名称</td>
                <td>报销人</td>
                <td>所属项目</td>
              </tr>
              <tr>
                <td>{{this.form.expense_id}}</td>
                <td>{{this.form.expense_name}}</td>
                <td>{{this.form.expense_pe_name}}</td>
                <td>{{this.form.expense_project_name}}</td>
              </tr>
              <tr>
                <td>报销类型</td>
                <td>日期区间</td>
                <td>天数</td>
                <td>提交日期</td>
              </tr>
              <tr>
                <td>{{this.form.expense_type}}</td>
                <td>{{this.form.expense_start_time}}  至  {{this.form.expense_end_time}}</td>
                <td>{{this.form.expense_days}}</td>
                <td>{{this.form.expense_submit_time}}</td>
              </tr>
              <tr>
                <td>税率</td>
                <td>支付币种</td>
                <td>支付币种到乌克兰币的汇率</td>
                <td>报销金额</td>
              </tr>
              <tr>
                <td>{{this.form.expense_pe_tax_rate}}</td>
                <td>{{this.form.expense_payment_currency}}</td>
                <td>{{this.form.payment_to_uah}}</td>
                <td>{{this.form.total_amount}}</td>
              </tr>
            </table>
            </div>
            </div>

            <!--报销单明细-->
            <div>
            <div class="tit-header">
                <div class="item">
                <p class="tab-title">报销单明细</p>
                </div>
            </div>

            <div class="tab">
                <el-table
                :header-cell-style="{background:'#F2F6FC',color:'#606266'}"
                :data="tableData"
                :row-class-name="rowClassName"
                ref="table"
                height="350px"
                tooltip-effect="dark"
                border
                style="width:100%">
                <el-table-column
                label="类型"
                prop="expense_type"
                align="center">
                </el-table-column>
                <el-table-column
                label="发票币种"
                prop="invoice_currency"
                align="center">
                </el-table-column>
                <el-table-column
                label="汇率"
                prop="exchange_rate"
                align="center">
                </el-table-column>
                <el-table-column
                label="报销金额"
                prop="expense_amount"
                align="center">
                </el-table-column>
                <el-table-column
                label="发票附件"
                align="center"
                width="200px">
                </el-table-column>
                </el-table>
            </div>
            </div>

            <!--审核详情-->
            <div>
            <div class="tit-header">
                <div class="item">
                <p class="tab-title">审核详情</p>
                </div>
            </div>

            <div class="tab">
                <el-table
                :header-cell-style="{background:'#F2F6FC',color:'#606266'}"
                :data="reviewData"
                :row-class-name="rowClassName"
                ref="reviewData"
                height="350px"
                tooltip-effect="dark"
                border
                style="width:100%">
                <el-table-column
                label="审核人"
                prop="reviewer"
                align="center">
                </el-table-column>
                <el-table-column
                label="审核人职位"
                prop="position"
                align="center">
                </el-table-column>
                <el-table-column
                label="审核意见"
                prop="comment"
                align="center">
                </el-table-column>
                <el-table-column
                label="审核结果"
                prop="result"
                align="center">
                </el-table-column>
                </el-table>
            </div>
            </div>

            <!--审核意见填写-->
            <div>
            <div class="tit-header">
                <div class="item">
                <p class="tab-title">审核意见填写</p>
                </div>
                <div class="item">
                <el-button type="primary" @click="review">提交审核意见</el-button>
                </div>
            </div>
            
            <div class="tab">
                <table>
                <tr>
                    <td>审核意见</td>
                    <td>审核结果</td>
                </tr>
                <tr>
                    <td><el-input v-model="comment" placeholder="请输入审核意见"></el-input></td>
                    <td>
                        <el-select v-model="result" placeholder="请选择审核结果">
                            <el-option label="通过" value="1"></el-option>
                            <el-option label="驳回" value="0"></el-option>
                        </el-select>
                    </td>
                </tr>
                </table>
            </div>
            </div>

        </div>
    </div>
    <span slot="footer" class="dialog-footer">
        <el-button @click="handleClose">关 闭</el-button>
        </span>
    </el-dialog>
</template>

<script>
import {seeMyReimbursementDetail,reviewReimbursement} from '@/request/other_api'
export default {
  data(){
    return {
      isAdd:'',
      dialogVisible:false,
      form: {},
      //报销明细数据
      tableData:[],
      //审核详情数据
      reviewData:[],
      //审核结果
      comment:'',
      result:'',
      statusNum:0,
    }
  },
  methods:{
    //序号
    rowClassName({ row, rowIndex }) {
      row.xh = rowIndex + 1;
    },
    handleClose (done) {
      this.dialogVisible = false
    },
    seeMyReimbursementDetail(expense_id){
      seeMyReimbursementDetail({
        expense_id:expense_id,
        is_examine:1
      }).then(res => {
        if(res.code == 200) {
          this.form = res.data.explain
          this.tableData = res.data.detail
          this.reviewData = res.data.review
          this.statusNum = res.data.explain.status
        }
      })
    },
    review(){
      reviewReimbursement({
          expense_id:this.form.expense_id,
          isAgree:this.result,
          examine_comments:this.comment
      }).then(res =>{
          if (res.code == 200) {
              this.$message.success("提交审核意见成功!")
              this.dialogVisible = false
              this.$parent.getPendingReview()
          }
      })
       
    }
  }
}

</script>

<style lang="less" scoped>
/deep/ .el-form-item__label {
  background-color: #eee;
  text-align: center;
  //width: 121px;
}
/deep/ .el-dialog__header {
  padding: 20px 20px 10px;
  border-bottom: 1px solid #eee;
}
/deep/ .el-dialog__body {
  padding: 10px 20px;
  color: #333;
  font-size: 15px;
  word-break: break-all;
}
.step{
  margin-bottom: 10px;
}
.content{
  margin-top: 10px;
  margin-bottom: 10px;

}
.tab-item{
  width: 100%;
  padding: 10px 0;
  border: 1px solid #eee;

  table{
    width: 100%;
    font-family: verdana,arial,sans-serif;
    font-size:14px;
    color:#333333;
    border-width: 1px;
    border-color: #999999;
    border-collapse: collapse;
  }
  table td{
    border-width: 1px;
    padding: 4px;
    border-style: solid;
    border-color: #999999;
    width: 25%;
  }
  table tr:nth-child(2n+1){
    background-color:#F2F6FC;
    height:50px;
    text-align: center;
  }
  table tr:nth-child(2n){
    background-color: #fff;
    height:60px;
    text-align: center;
  }

.tab-title{
  font-family: SourceHanSansSC;
  font-weight: 700;
  font-size: 20px;
  color: rgb(16, 16, 16);
  font-style: normal;
  letter-spacing: 0px;
  line-height: 30px;
  text-decoration: none;
  padding: 5px 10px;
}
/deep/ .el-date-editor.el-input, .el-date-editor.el-input__inner {
  width: 100%;
 }
}

.tit-header{
display: flex;
justify-content: space-between;
margin: 10px 0;
}

</style>
